package Code.StringCompare;

import java.util.Scanner;

public class demo {
    public static void main(String[] args) {
        String s1 = "adb";
        String s2 = "adb";
        //因为直接赋值存储的地方是串池里面，数据一样的话，会复用
        System.out.println(s1 == s2);//true

        String s3 = new String("abc" );
        String s4 = new String("abc" );
        //因为new出来的地址值不一样
        System.out.println(s3 == s4); //false
        //一个是再堆空间，一个是在字符串池，地址不一样
        System.out.println(s3 == s2); //false


        System.out.println(s3.equals(s4)); //比较的值完全一样才是true
        String s5 = new String("ABC");
        System.out.println(s3.equalsIgnoreCase(s5)); //忽略大小写

        Scanner scanner = new Scanner(System.in);
        String i= scanner.next();
    }
}
